# ------------------------------------------------------------------------------
# Replication Materials
# 
# title: Eliciting Beliefs as Distributions in Online Surveys
# journal: Political Analysis
# authors: Lucas Leemann, Richard Traunmüller, and Lukas Stoetzer
# date: August 2020
# ------------------------------------------------------------------------------




### R code Data cleaner

data <- read.csv("in/Prior_Elicitation_Nachtrag_Quantile ASYMETRIC.csv", sep=",", header=T)

dim(data)
data <- data[-c(1:2),] 

### Median Question
table(data$Q80)
data$Q80[data$Q80==""] <- NA
#data$Q80 <- droplevels(data$Q80)

table(data$Q95)
data$Q95[data$Q95==""] <- NA
#data$Q95 <- droplevels(data$Q95)

table(data$Q97)
data$Q97[data$Q97==""] <- NA
#data$Q97 <- droplevels(data$Q97)

### Screener Questions
table(data$Q135)
#data$Q135 <- droplevels(data$Q135)
data$screen1 <- ifelse(data$Q135=="Purple and yellow", 1, 0)

table(data$Q127)
#data$Q127 <- droplevels(data$Q127)
data$screen2 <- ifelse(data$Q127=="University of Zurich", 1, 0)


prop.table(table(data$screen1))
prop.table(table(data$screen2))
